home *** CD-ROM | disk | FTP | other *** search
- Path: iz.maus.de!Torsten_Landschoff
- From: Torsten_Landschoff@iz.maus.de (Torsten Landschoff)
- Newsgroups: comp.lang.c++
- Subject: Re: Memory leak in Borland C++ Tutorial?
- Message-ID: <199603110026.a35682@iz.maus.de>
- Date: Sun, 10 Mar 96 22:26:00 GMT
- References: <4htq3a$lon@status.gen.nz>
- X-Gate: MausGate/News 1.25/ac3
- MIME-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
-
- Hi David!
-
- DT>I have recently purchased Borland C++ 4.51, and am working my way
- DT>through the ObjectWindows Tutorial book. However, I am very puzzled,
- DT>as in many places, the code shown looks like it will cause memory
- DT>leaks.
-
- It seems to do that but it doesn't. For example:
-
- DT>if ( new TFileSaveDialog( this, "FileData()->Execute() == IDOK ) )
- DT>SaveFile();
-
- The constructor of TFileSaveDialog registers the new dialog at the first
- parameter given - the this object. If this is freed the dialog is freed to.
-
- DT>SetMainWindow( new TFrameWindow( 0, "Sample ObjectWindows Program" ) )
-
- This only sets a global variable which is cleaned up automatically on exit.
-
- cu
- Torsten
-